/*******************************************************************************
 *  FormElement class
 *******************************************************************************

// options example
var options = {
    id: 'id',
    action: 'URL',
    method: 'POST',
    classes: 'class',
    title: 'Title text',
    description: 'Description text'
}

*/

var FormElement = function(options) {
    
    // this class should extend an Element class
    $.extend(true, this, new Element($('<form>')))
    
    // ------------------------------------------------------- settings
    this.defaults = {
        method: 'POST'
    };
    
    var settings = this.prepareSettings(options);
    
    // ------------------------------------------------------- methods
    
    /**
     *  Submits form
     */
    this.submit = function(){
        this.getElement().submit();
    }
    
    // ------------------------------------------------------- element creation
    this.setId(settings.id)
        .addClass('form-horizontal')
        .addClass(settings.classes)
        .addAttribute('action', settings.action)
        .addAttribute('method', settings.method);
        
    console.log('FormElement was created with id = '+this.getId());
}